package com.javatian.dao;

import com.javatian.entity.OrderGoodsRel;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * 订单商品关系映射Dao
 */
@Repository
public interface OrderGoodsRelDao extends Mapper<OrderGoodsRel> {
    /*根据订单主键id查询商品列表*/
    List<OrderGoodsRel> findByOrderId(Long orderId);

    /*删除某个订单的所有商品关联关系*/
    int deleteByOrderId(Long orderId);

    /*总销量*/
    @Select("select sum(count) from order_goods_rel")
    Integer totalShopping();



}
